using System.Text.RegularExpressions;

namespace FadeLang.CstVisitor
{
    public class StringVisitor : FadeLangBaseVisitor<string>
    {
        private static StringVisitor instance;
        public static StringVisitor Instance => instance ?? (instance = new StringVisitor());

        public override string VisitString(FadeLangParser.StringContext context) {
            return Regex.Unescape(context.GetText().Substring(1, context.GetText().Length - 2));
        }
    }
}